﻿using System;
using System.Windows.Forms;

namespace p301.Reports.PrichObr
{
	public partial class FrmIntervalPrichKons : VC.Framework.Report.FrmInterval
	{
		public FrmIntervalPrichKons()
		{
			InitializeComponent();
		}

		public DateTime DataS
		{
			get { return _DataS.Date.Value; }
		}

		public DateTime DataPo
		{
			get { return _DataPo.Date.Value.Add(new TimeSpan(23, 59, 59)); }
		}

		public bool IsKonsOnly
		{
			get { return _rbIsKonsOnlyYes.Checked; }
		}

		private void _bExit_Click(object sender, EventArgs e)
		{
			this.DialogResult = DialogResult.Cancel;
			Close();
		}

		private void _bCreate_Click(object sender, EventArgs e)
		{
			if (_DataS.Text == "" || _DataPo.Text == "")
			{
				MessageBox.Show("Заполните две даты", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
			}
			else
			{
				this.DialogResult = DialogResult.OK;
				Close();
			}
		}

		private void FrmIntervalPrichKons_Shown(object sender, EventArgs e)
		{
			_DataPo.Text = null;
			_DataS.Text = null;
			_DataS.Select();
			_rbIsKonsOnlyYes.Checked = true;
		}
	}
}
